﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <WtmSearcher v-model="searchDataLMESBadCodeTemplate" @search="()=>{getTableDataLMESBadCodeTemplate();}">
      <el-row>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="LMESBadCode_FormItem" prop="LMESBadCode" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_LMESBadCode')">
            <el-input v-model="searchDataLMESBadCodeTemplate.LMESBadCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="LMESBadDescription_FormItem" prop="LMESBadDescription" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_LMESBadDescription')">
            <el-input v-model="searchDataLMESBadCodeTemplate.LMESBadDescription" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="OperationCode_FormItem" prop="OperationCode" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_OperationCode')">
            <el-input v-model="searchDataLMESBadCodeTemplate.OperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="BadCode_FormItem" prop="BadCode" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_BadCode')">
            <el-input v-model="searchDataLMESBadCodeTemplate.BadCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="BadName_FormItem" prop="BadName" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_BadName')">
            <el-input v-model="searchDataLMESBadCodeTemplate.BadName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="BadTypeCode_FormItem" prop="BadTypeCode" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_BadTypeCode')">
            <el-input v-model="searchDataLMESBadCodeTemplate.BadTypeCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="BadTypeName_FormItem" prop="BadTypeName" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_BadTypeName')">
            <el-input v-model="searchDataLMESBadCodeTemplate.BadTypeName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="AddTime_FormItem" prop="AddTime" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_AddTime')">
            <el-date-picker v-model="searchDataLMESBadCodeTemplate.AddTime" type='daterange' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="DataStatus_FormItem" prop="DataStatus" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_DataStatus')">
            <el-input v-model="searchDataLMESBadCodeTemplate.DataStatus" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="EditTime_FormItem" prop="EditTime" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_EditTime')">
            <el-date-picker v-model="searchDataLMESBadCodeTemplate.EditTime" type='daterange' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="EnableStatus_FormItem" prop="EnableStatus" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_EnableStatus')">
            <el-input v-model="searchDataLMESBadCodeTemplate.EnableStatus" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="FactoryCode_FormItem" prop="FactoryCode" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_FactoryCode')">
            <el-input v-model="searchDataLMESBadCodeTemplate.FactoryCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="Field1_FormItem" prop="Field1" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_Field1')">
            <el-input v-model="searchDataLMESBadCodeTemplate.Field1" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="Field2_FormItem" prop="Field2" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_Field2')">
            <el-input v-model="searchDataLMESBadCodeTemplate.Field2" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="Field3_FormItem" prop="Field3" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_Field3')">
            <el-input v-model="searchDataLMESBadCodeTemplate.Field3" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="Field4_FormItem" prop="Field4" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_Field4')">
            <el-input v-model="searchDataLMESBadCodeTemplate.Field4" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="Field5_FormItem" prop="Field5" :label="$t('message.autotrans._Model_LMESBadCodeTemplate_Field5')">
            <el-input v-model="searchDataLMESBadCodeTemplate.Field5" clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

  </WtmSearcher>

  <div style="text-align: right;">
      <WtmButton v-auth="'/api/BaseInformation/LMESBadCodeTemplate/Create'" icon='fa fa-plus' type='primary' :button-text="$t('message.autotrans.SysCreate')" @click="OnCreateClick()"/>
    <WtmButton v-auth="'/api/BaseInformation/LMESBadCodeTemplate/BatchDelete'"  icon='fa fa-trash' type='danger' :button-text="$t('message.autotrans.SysDelete')" :confirm="$t('message._system.common.vm.deletetip')" @click="onBatchDelete()"/>
    <WtmButton v-auth="'/api/BaseInformation/LMESBadCodeTemplate/BatchEdit'" icon='fa fa-pencil-square' type='primary' :button-text="$t('message.autotrans.SysBatchEdit')" @click="OnBatchEditClick()"/>
    <WtmButton v-auth="'/api/BaseInformation/LMESBadCodeTemplate/Import'" icon='fa fa-tasks' type='primary' :button-text="$t('message.autotrans.SysImport')" @click="OnImportClick()"/>
    <WtmButton v-auth="'/api/BaseInformation/LMESBadCodeTemplate/LMESBadCodeTemplateExportExcel'"  icon='fa fa-arrow-circle-down' type='primary' :button-text="$t('message.autotrans.SysExport')" @click="onExport()"/>

  </div>
  <WtmTable ref="tableRefLMESBadCodeTemplate" v-bind="tableDataLMESBadCodeTemplate">
    <template #operation>
      <el-table-column :label="$t('message._system.common.vm.operate')" width="180">
        <template v-slot="scope">
            <WtmButton v-auth="'/api/BaseInformation/LMESBadCodeTemplate/Edit'" :is-text="true" icon='fa fa-pencil-square' type='warning' :button-text="$t('message.autotrans.SysEdit')" @click="OnEditrowClick(scope.row)"/>
          <WtmButton v-auth="'/api/BaseInformation/LMESBadCodeTemplate/{id}'" :is-text="true" icon='fa fa-info-circle' type='info' :button-text="$t('message.autotrans.Page详情')" @click="OnDetailsrowClick(scope.row)"/>
          <WtmButton v-auth="'/api/BaseInformation/LMESBadCodeTemplate/BatchDelete'"  icon='fa fa-trash' type='danger' :button-text="$t('message.autotrans.SysDelete')" :confirm="$t('message._system.common.vm.deletetip')" :is-text="true"  @click="onDelete(scope.row)"/>

        </template>
      </el-table-column>
    </template>
  </WtmTable>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageBaseInformationLMESBadCodeTemplateIndex;true;TyMES.BaseInformation.Controllers;LMESBadCodeTemplate">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { lmesbadcodetemplateApi } from '/@/api/baseinformation/lmesbadcodetemplate';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


const CreateDialog = defineAsyncComponent(() => import('./create.vue'));
const EditDialog = defineAsyncComponent(() => import('./edit.vue'));
const DetailsDialog = defineAsyncComponent(() => import('./details.vue'));
const BatchEditDialog = defineAsyncComponent(() => import('./batchedit.vue'));
const ImportDialog = defineAsyncComponent(() => import('./import.vue'));

const stateLMESBadCodeTemplate = reactive({
    
});

const searchDataLMESBadCodeTemplate = ref({
        LMESBadCode: '',
        LMESBadDescription: '',
        OperationCode: '',
        BadCode: '',
        BadName: '',
        BadTypeCode: '',
        BadTypeName: '',
        AddTime: undefined,
        DataStatus: '',
        EditTime: undefined,
        EnableStatus: '',
        FactoryCode: '',
        Field1: '',
        Field2: '',
        Field3: '',
        Field4: '',
        Field5: '',
});

// 定义变量内容
const tableRefLMESBadCodeTemplate = ref();
const tableDataLMESBadCodeTemplate = ref({
    // 列表数据（必传）
    data: [],
	// 表头内容（必传，注意格式）
	header: [
      {title:ci.proxy.$t('message.autotrans.Page产线不良信息编号'),key: 'LMESBadCodeTemplate_LMESBadCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page产线不良信息描述'),key: 'LMESBadCodeTemplate_LMESBadDescription',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工序信息'),key: 'LMESBadCodeTemplate_OperationCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page不良编码'),key: 'LMESBadCodeTemplate_BadCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page不良名称'),key: 'LMESBadCodeTemplate_BadName',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page不良类型编码'),key: 'LMESBadCodeTemplate_BadTypeCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page不良类型名称'),key: 'LMESBadCodeTemplate_BadTypeName',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page添加时间'),key: 'LMESBadCodeTemplate_AddTime',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page数据状态'),key: 'LMESBadCodeTemplate_DataStatus',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page编辑时间'),key: 'LMESBadCodeTemplate_EditTime',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page启用状态'),key: 'LMESBadCodeTemplate_EnableStatus',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工厂编码'),key: 'LMESBadCodeTemplate_FactoryCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page预留域1'),key: 'LMESBadCodeTemplate_Field1',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page预留域2'),key: 'LMESBadCodeTemplate_Field2',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page预留域3'),key: 'LMESBadCodeTemplate_Field3',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page预留域4'),key: 'LMESBadCodeTemplate_Field4',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page预留域5'),key: 'LMESBadCodeTemplate_Field5',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans._AdminIsValid'),key: 'LMESBadCodeTemplate_IsValid',type: 'switch',isCheck: true},

	],
	// 配置项（必传）
	config: {
        total: 0, // 列表总数
		loading: true, // loading 加载
		isSerialNo: true, // 是否显示表格序号
		isSelection: true, // 是否显示表格多选
		isOperate: true, // 是否显示表格操作栏
	}
});
// 初始化表格数据
const getTableDataLMESBadCodeTemplate = () => {
    tableRefLMESBadCodeTemplate.value.doSearch(lmesbadcodetemplateApi().search, searchDataLMESBadCodeTemplate.value)
        .catch((error: any) => {
			other.setFormError(ci, error);
		});
};
const OnCreateClick = () => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysCreate'), CreateDialog, null, getTableDataLMESBadCodeTemplate)
};

const OnEditrowClick = (row: any) => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysEdit'), EditDialog, row, getTableDataLMESBadCodeTemplate)
};

const OnDetailsrowClick = (row: any) => {
    other.openDialog(ci.proxy.$t('message.autotrans.Page详情'), DetailsDialog, row, getTableDataLMESBadCodeTemplate)
};

// 删除
const onDelete = (row: any) => {
    lmesbadcodetemplateApi().delete([row.ID]).then(() => { getTableDataLMESBadCodeTemplate()})
};

const onBatchDelete = () => {
    const selectedrows = tableRefLMESBadCodeTemplate.value.getSelectedRows();
    const selectedids = selectedrows.map((x: any) => x.ID);
    if (selectedids.length > 0)
      lmesbadcodetemplateApi().delete(selectedids).then(() => { getTableDataLMESBadCodeTemplate()})
    else
      ElMessage.error(ci.proxy.$t('message._system.common.vm.check'));
};

const OnBatchEditClick = () => {
    const selectedrows = tableRefLMESBadCodeTemplate.value.getSelectedRows();
    const selectedids = selectedrows.map((x: any) => x.ID);
    if (selectedids.length > 0)
      other.openDialog(ci.proxy.$t('message.autotrans.SysBatchEdit'), BatchEditDialog, selectedids, getTableDataLMESBadCodeTemplate)
    else
      ElMessage.error(ci.proxy.$t('message._system.common.vm.check'));
};

const OnImportClick = () => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysImport'), ImportDialog, null, getTableDataLMESBadCodeTemplate)
};

const onExport = () => {
	const selected = tableRefLMESBadCodeTemplate.value.getSelectedRows();
	if (selected.length > 0) {
		lmesbadcodetemplateApi().exportById(selected.map((x: any) => x.ID));
	}
	else {
		lmesbadcodetemplateApi().export({});
	}
};



// 页面加载时
onMounted(() => {
    
        getTableDataLMESBadCodeTemplate();

});

// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

